<%-- 
    Document   : Login
    Created on : Apr 24, 2010, 5:21:39 PM
    Author     : rafik Ouanouki
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Login</title>
    </head>
    <body>
        <h1> Sign in </h1>
        <!-- Get the User and Password -->
        <form method="POST" action="login.jsp">
            <div>
                <tr><td>Username :</td><td> <input type="text" name="username" size="20"/> </td></tr><br>
                <tr><td>Password :</td><td> <input type="password" name="password" size="20"/> </td></tr>
            </div>
            <div>
                <input type="submit" name="btnLogin" value="Submit"/>
            </div>
        </form>
    </body>
</html>

<%@page import="sim.BL.Login"%>
<%@page import="sim.BL.Member"%>

<%
    Member member;

    String username = request.getParameter("username");
    String password = request.getParameter("password");

    if (username != null && password != null) {
        if (Login.ValidateCredentials(username, password)) {
            session.setAttribute("username", username);
            pageContext.forward("details.jsp");
        }
        else out.println("Wrong password ! Try again ");
    }
    %>